odds and ends (#964)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 29 Dec 2022 19:47:11 +0000 (12:47 -0700)
committerGitHub <noreply@github.com>
Thu, 29 Dec 2022 19:47:11 +0000 (12:47 -0700)
* odds and ends

support subseconds in exif GPSTimeStamp. While rare, some devices
provide subsecond information.

add missing include guards.

use cmake for mkicondoc, retiring the last qmake build.

provide default initializers for a couple of data members.

kill some empty statements.

* Dont' use case_ignore_strcmp for two QStrings.

12 files changed:
CMakeLists.txt
discard.h
exif.cc
garmin_device_xml.h
garmin_txt.cc
gbser_private.h
gui/latlng.h
mkicondoc.cc
mkicondoc/mkicondoc.pro [deleted file]
nmea.h
src/core/codecdevice.h
src/core/logging.h

index 6a985892ded735907862267c9453827be6618be5..00536ca5ea3a21865a1e22ff3918c8168c5daad8 100644 (file)
@@ -367,6 +367,11 @@ message(STATUS "Libs are: \"${LnkLibs}\"")
 get_target_property(IncDirs gpsbabel INCLUDE_DIRECTORIES)
 message(STATUS "Include Directores are: \"${IncDirs}\"")
 
+# In case we ever update the garmin_icons mkicondoc helps 
+# update the related document table.
+add_executable(mkicondoc EXCLUDE_FROM_ALL mkicondoc.cc)
+target_link_libraries(mkicondoc PRIVATE ${QT_LIBRARIES})
+
 set(TESTS
   arc-project
   arc
index 8e8881198378fb280b0224bf650b5749820c3c5d..ad5c4cfbf1650e694c31e42361adc8015655ddb0 100644 (file)
--- a/discard.h
+++ b/discard.h
@@ -66,7 +66,7 @@ private:
   int satpf{};
   int eleminpf{};
   int elemaxpf{};
-  gpsdata_type what;
+  gpsdata_type what{};
   route_head* head{};
 
   QVector<arglist_t> args = {
diff --git a/exif.cc b/exif.cc
index 8c41c45faecd557e06f9b5b72dc0a340f3266b2b..956d34ba5dd844b002eec285c512dca6b028aeab 100644 (file)
--- a/exif.cc
+++ b/exif.cc
@@ -254,7 +254,7 @@ ExifFormat::exif_read_timestamp(const ExifTag* tag)
   double min = exif_read_double(tag, 1);
   double sec = exif_read_double(tag, 2);
 
-  return QTime(int(hour), int(min), int(sec));
+  return QTime(0, 0).addMSecs(lround((((hour * 60.0) + min) * 60.0 + sec) * 1000.0));
 }
 
 QDate
index 43495ebb9ea858049cc0db006d6aa55183e88b26..6796b1be34f73cd03e4d892cbd33621332e78e23 100644 (file)
@@ -19,6 +19,8 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
  */
+#ifndef GARMIN_DEVICE_XML_H_
+#define GARMIN_DEVICE_XML_H_
 
 /*
  * Describes a file on the unit.
@@ -54,3 +56,4 @@ const gdx_info* gdx_find_file(char** dirlist);
 #include <csetjmp>
 extern jmp_buf gdx_jmp_buf;
 
+#endif // GARMIN_DEVICE_XML_H_
index dd24e4197851f9e8b42c429889ccae2470be2be4..1f102763c66c7b6fce477ddce9c586f3cc1b2374 100644 (file)
@@ -229,7 +229,7 @@ enum_waypt_cb(const Waypoint* wpt)
     }
     for (int i = 0; i < wpt_a_ct; i++) {               /* check for duplicates */
       const Waypoint* tmp = wpt_a[i];
-      if (case_ignore_strcmp(tmp->shortname, wpt->shortname) == 0) {
+      if (tmp->shortname.compare(wpt->shortname, Qt::CaseInsensitive) == 0) {
         wpt_a[i] = wpt;
         waypoints--;
         return;
index 37c889eec7e7435573f1526a62eb75fb3696e20d..568d6314b6bc270c93c34f36931ac4aa8f199237 100644 (file)
@@ -18,6 +18,8 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
  */
+#ifndef GBSER_PRIVATE_H_
+#define GBSER_PRIVATE_H_
 
 #define MYMAGIC 0x91827364
 #define BUFSIZE 512
@@ -25,3 +27,4 @@
 void gbser_db(int l, const char* msg, ...);
 int gbser_fill_buffer(void* h, unsigned want, unsigned* ms);
 unsigned gbser_read_buffer(void* handle, void** buf, unsigned* len);
+#endif // GBSER_PRIVATE_H_
index 10c9d603a133ad3109061313afe8c0c1d16d4b36..44c390108cc5df79fddf5363918fd4c6380e0333 100644 (file)
@@ -28,8 +28,8 @@
 class LatLng
 {
 public:
-  LatLng(): _lat(0), _lng(0) {};
-  LatLng(double lat, double lng): _lat(lat), _lng(lng) {};
+  LatLng(): _lat(0), _lng(0) {}
+  LatLng(double lat, double lng): _lat(lat), _lng(lng) {}
   double lat() const
   {
     return _lat;
index afeb6f73a08f46b1ca22c7c6a861aebbaf7c01c7..94a7a21bc9bd77315695f8e36735eee8617cc0c6 100644 (file)
@@ -1,6 +1,5 @@
 // Display all the Garmin icons that we know about so we can copy/paste
 // into our doc, xmldoc/chapters/garmin_icons.xml.
-// cd mkicondoc && qmake && make
 
 #include <algorithm>             // for sort
 #include <cstdio>                // for printf
diff --git a/mkicondoc/mkicondoc.pro b/mkicondoc/mkicondoc.pro
deleted file mode 100644 (file)
index 24a3123..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-QT -= gui
-
-CONFIG += console
-CONFIG -= app_bundle
-CONFIG += c++17
-
-TEMPLATE = app
-
-SOURCES += ../mkicondoc.cc
diff --git a/nmea.h b/nmea.h
index 61f5c0b38e51821858a2a819a1f166a81ef963e2..e0f3a679d9b1b03f7a9a28f42fece4ee0129a0c8 100644 (file)
--- a/nmea.h
+++ b/nmea.h
@@ -94,11 +94,11 @@ private:
     gprmc
   };
 
-  enum {
+  enum read_mode_type {
     rm_unknown = 0,
     rm_serial,
     rm_file
-  } read_mode;
+  };
 
   /* Member Functions */
 
@@ -132,7 +132,8 @@ private:
   gbfile* file_in{}, *file_out{};
   route_head* trk_head{};
   short_handle mkshort_handle{};
-  preferred_posn_type posn_type;
+  preferred_posn_type posn_type{};
+  read_mode_type read_mode{};
   QDateTime prev_datetime;
   Waypoint* curr_waypt{};
   Waypoint* last_waypt{};
index 6ccb7e8acd0718e2b644ec0effe5ed5913799280..596bc2dcb0f3bf3975ead4294080cf8a7afc6a5c 100644 (file)
@@ -16,6 +16,8 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
  */
+#ifndef SRC_CORE_CODECDEVICE_H_
+#define SRC_CORE_CODECDEVICE_H_
 
 #include <QIODevice>        // for QIODevice
 #include <QIODeviceBase>    // for QIODeviceBase::OpenMode
@@ -61,3 +63,4 @@ private:
 };
 
 } // namespace
+#endif // SRC_CORE_CODECDEVICE_H_
index c0356d201df6672ec0c8d7ee833413f40c4ea7f3..c3932d99247b1295dff88151f6989ceb9560473b 100644 (file)
@@ -16,8 +16,8 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
  */
-#ifndef gpsbabel_logging_h_included
-#define gpsbabel_logging_h_included
+#ifndef SRC_CORE_LOGGING_H_
+#define SRC_CORE_LOGGING_H_
 
 // A wrapper for QDebug that provides a sensible Warning() and FatalMsg()
 // with convenient functions, stream operators and manipulators.
@@ -79,4 +79,4 @@ namespace Qt
   inline QTextStream& uppercasedigits(QTextStream &s) { return ::uppercasedigits(s); }
 }
 #endif
-#endif //  gpsbabel_logging_h_included
+#endif //  SRC_CORE_LOGGING_H_